package top.alanshelby.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import top.alanshelby.entity.Item;
import top.alanshelby.service.ItemService;

import java.util.List;

@RestController
@RequestMapping(value = "item")
public class RestTestController {

    @Autowired
    private ItemService itemService;

    @RequestMapping(value = {"itemList", "items"}, method = RequestMethod.GET)
    public List<Item> itemList() {
        List<Item> itemList = itemService.findItemList();
        return itemList;
    }

    @RequestMapping(value = {"itemList", "items"}, method = RequestMethod.POST)
    public List<Item> itemList2() {
        List<Item> itemList = itemService.findItemList();
        return itemList;
    }

//    @RequestMapping(value = "itemList")
//    public List<Item> itemList() {
//        List<Item> itemList = itemService.findItemList();
//        return itemList;
//    }

}
